import requests
import re


# 最高最低温度
def get_weather(url):
    response = requests.get(url)
    response.encoding = 'utf-8'

    # 抓取当天气温（非实时）
    aim = re.findall('<input type="hidden" id="hidden_title" value="(.*?)月(.*?)日(.*?)时 (.*?)  (.*?)  (.*?)"', response.text, re.S)
    # print("今日气温：%s" % aim[0][5])
    today_temp = "%s" % aim[0][5]
    today_temp = today_temp[0:5]
    return today_temp

